{include file="public/header" /}
<body>
<style>
    .cion{
        display: inline-block;
        width: 120px;
    }
</style>
<nav class="breadcrumb"><i class="Hui-iconfont">&#xe67f;</i> 首页
    <span class="c-gray en">&gt;</span> OTC管理
    <span class="c-gray en">&gt;</span> 订单列表
    <a class="btn btn-success radius r" style="line-height:1.6em;margin-top:3px" href="/otc/otc_order_lists" title="刷新" ><i class="Hui-iconfont">&#xe68f;</i></a>
</nav>
<div class="page-container">
    <form  method="get" action="">
        <div class="text-c">
            <span class="select-box" style="width: 100px;">
                <select name="select_type" class="select">
                    <option value="-1">查询条件</option>
                    <option value="1" {if isset($_GET['select_type']) && $_GET['select_type'] == 1}selected{/if}>买家订单号</option>
                    <option value="2" {if isset($_GET['select_type']) && $_GET['select_type'] == 2}selected{/if}>卖家订单号</option>
                    <option value="3" {if isset($_GET['select_type']) && $_GET['select_type'] == 3}selected{/if}>买家手机号</option>
                    <option value="4" {if isset($_GET['select_type']) && $_GET['select_type'] == 4}selected{/if}>卖家手机号</option>
                </select>
            </span>
            <input type="text" value="{:input('get.keyword')}" name="keyword" class="input-text" style="width:160px;">

            订单时间：
            <span class="select-box" style="width: 100px;">
                <select name="time_type" class="select">
                    <option value="-1">时间类型</option>
                    <option value="1" {if isset($_GET['time_type']) && $_GET['time_type'] == 1}selected{/if}>创建时间</option>
                    <option value="2" {if isset($_GET['time_type']) && $_GET['time_type'] == 2}selected{/if}>完成时间</option>
                </select>
            </span>
            <input type="text" onfocus="WdatePicker()" value="{:input('get.start')}" name="start" id="datemin" class="input-text Wdate" style="width:120px;" autocomplete="off">
            -
            <input type="text" onfocus="WdatePicker()" value="{:input('get.end')}" name="end" id="datemax" class="input-text Wdate" style="width:120px;" autocomplete="off">

            <span class="select-box" style="width: 100px;">
                <select name="status" class="select">
                    <option value="-1">全部状态</option>
                    <option value="0" {if isset($_GET['status']) && $_GET['status'] == 0}selected{/if}>待支付</option>
                    <option value="1" {if isset($_GET['status']) && $_GET['status'] == 1}selected{/if}>已支付/待放行</option>
                    <option value="2" {if isset($_GET['status']) && $_GET['status'] == 2}selected{/if}>已完成/已放行</option>
                </select>
            </span>
            <button type="submit" class="btn btn-success">搜索</button>
        </div>
    </form>

    <div class="cl pd-5 bg-1 bk-gray mt-20">
        <span class="l">
        </span>
        <span class="r">共有数据：<strong>{$page->total()}</strong> 条</span> </div>
    <table class="table table-border table-bordered table-hover table-bg">
        <thead>
        <tr>
            <th scope="col" colspan="13a">出售列表</th>
        </tr>
        <tr class="text-c">
            <th width="15">id</th>
            <th width="120" style="color: #00B83F">买家订单号</th>
            <th width="120" style="color: #00B83F">买家信息</th>
            <th width="120">卖家订单信息</th>
            <th width="120">卖家信息</th>
            <th width="60">购买数量</th>
            <th width="110" style="color: #00B83F">付款方式(查看凭证)</th>
            <!--<th width="50">手续费</th>-->
            <th width="150">时间</th>
<!--            <th width="50">备注</th>-->
            <th width="50">状态</th>
            <th width="80">操作</th>
        </tr>
        </thead>
        <tbody>
        {foreach $list as $v}
        <td>{$v.id}</td>
        <td>{$v.order_no}</td>
        <td>     买家姓名：{$v.buynickname}
            </br>买家手机：{$v.buymobile}
            </br>买家ID： {$v.buyer_uid}
        </td>
        <td>卖家订单ID：{$v.parent_order_id}</br>
            卖家订单号：</br>{$v.parent_order_no}</br>
        </td>
        <td>     卖家姓名：{$v.nickname}
            </br>卖家手机：{$v.mobile}
            </br>卖家ID： {$v.seller_uid}
        </td>
        <td style="text-align: center">{$v.buy_num} MT</td>
        <td>
            {if condition="$v['bank']['type'] eq 1"}<span style="color: #438eff">支付宝</span>:{$v['bank']['account']}&nbsp&nbsp{notempty name="v.credentials"}</br><em class="label label-success radius" style="cursor:pointer" onclick="lookc({$v.id})">查看凭证</em>{/notempty}{/if}
            {if condition="$v['bank']['type'] eq 2"}<span style="color: #22d059">微信</span>:{$v['bank']['account']}&nbsp&nbsp{notempty name="v.credentials"}</br><em class="label label-success radius" style="cursor:pointer" onclick="lookc({$v.id})">查看凭证</em>{/notempty}{/if}
            {if condition="$v['bank']['type'] eq 3"}<span style="color: #cd141a">银行卡</span>:{$v['bank']['bank_name']}&nbsp&nbsp{notempty name="v.credentials"}</br><em class="label label-success radius" style="cursor:pointer" onclick="lookc({$v.id})">查看凭证</em>{/notempty}{/if}
        </td>
        <!--<td style="text-align: center">{$v.poundage} MT</td>-->
        <td>
                 <em style="color: #00b7ee">创建时间</em>: {$v.create_time}
            </br><em style="color: #bd362f">支付时间</em>: {$v.pay_time}
            </br><em style="color: #00B83F">完成时间</em>: {$v.finish_time}
        </td>
<!--        <td>{$v.remark}</td>-->
        <td style="text-align: center">
            {switch name="$v.status"}
                {case value="0"}
                    <span class="label label-default radius">待支付</span>
                    </br><span>|</span>
                    </br><span class="label label-danger radius">{$v.countDown}</span>
                {/case}
                {case value="1"}
                    <span class="label label-primary radius">已支付/待放行</span>
                {/case}
                {case value="2"}
                    <span class="label label-success radius">已完成/已放行</span>
                {/case}
                {case value="6"}
                    <span class="label label-danger radius">超时未付款！</span>
                {/case}
            {/switch}
        </td>
        <td style="text-align: center">
            {switch name="$v.status"}
                {case value="1"}
                    <a class="btn btn-default radius" title="放行" href="javascript:;" onclick="release({$v.id})">放行</a>
                {/case}
            {/switch}
        </td>
        </td>
        </tr>
        {/foreach}
        </tbody>
    </table>
    <div class="page">
        {$page->render()|raw}
    </div>
</div>

{include file="public/footer" /}

<script type="text/javascript">
    //调出凭证页面
    function lookc(id){
        layer.open({
            type: 2,
            title: '凭证',
            area: ['450px', '700px'],
            fixed: false, //不固定
            maxmin: true,
            content: "credentials.html?id="+id,
        });
    }

    /*商品上下架*/
    function release(id) {
        var tip = '确认要放行吗？';
        layer.confirm(tip,function(index){
            $.ajax({
                type: 'POST',
                url: "{:url('release')}",
                data:{'id':id},
                dataType: 'json',
                success: function(res){
                    if(res.status == 1){
                        layer.msg(res.info,{icon:1,time:1000,shade: [0.3, '#000']},function(){
                            location.reload();
                        });
                    }else{
                        layer.msg(res.info,{icon:2,time:1000,shade: [0.3, '#000']});
                    }
                },
                error:function(res) {
                    console.log(res.info);
                },
            });
        });

    }

</script>
